'\"macro stdmacro
.\"
.\" Copyright (c) 2018 Red Hat.  All Rights Reserved.
.\" Copyright (c) 2009 Aconex.  All Rights Reserved.
.\"
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\"
.\"
.TH PMDAPOSTGRESQL 1 "PCP" "Performance Co-Pilot"
.SH NAME
\f3pmdapostgresql\f1 \- PostgreSQL database PMDA
.SH DESCRIPTION
\f3pmdapostgresql\f1 is a Performance Co-Pilot (PCP) Performance Metrics
Domain Agent (PMDA) which extracts live performance data from a running
PostgreSQL database server.
.PP
Many of the statistics available from a PostgreSQL server may not
be enabled by default.
Refer to the online documentation
.B https://postgresql.org/docs/current/static/monitoring-stats.html
which describes each of the available parameters related to statistics
collection and how to enable them.
.SH CONFIGURATION
\fBpmdapostgresql\fP reads a mandatory ini-style configuration file:
.IP
.PD 0
.IP
.I \f(CR$PCP_PMDAS_DIR\fP/postgresql/postgresql.conf
.PD
.PP
This file currently contains only one section
.B [authentication]
which specifies values for the following settings
(their default values are shown in parenthesis):
.TP 15
.B host \fR(\fP\fIlocal\fP\fR)\fP
Hostname to connect to.
.TP
.B port \fR(\fP\fI5432\fP\fR)\fP
Port number to use.
.TP
.B dbname \fR(\fP\fIpostgres\fP\fR)\fP
Database name.
.TP
.B username \fR(\fP\fIpostgres\fP\fR)\fP
Username to run as and to connect to the database.
.TP
.B password \fR(\fP\fIpassword\fP\fR)\fP
Password to connect to the database.
.TP
.B osuser \fR(unset)\fP
Operating system user the PMDA runs as.
.PP
The defaults (as above) will result in the PMDA running as the current
user, using a UNIX domain socket connection to the PostgreSQL server on
the localhost.
.PP
If
.B osuser
is not specified in the configuration file, the PMDA will run as the
current user.
A host specification of \fIlocal\fP will use a UNIX domain socket, which
uses peer authentication, see comments in the
.B pg_hba.conf
file.
In this case, the
.B osuser
setting should probably be set to
.BR postgres .
.PP
It is generally not necessary to alter the default configuration file
for monitoring the local PostgreSQL server instance with a default
server configuration.
Note that the port number is required even for a UNIX domain connection
because it's used as the socket filename by the server.
.SH INSTALLATION
To install, the following must be done as root:
.sp 1
.RS +4
.ft B
.nf
# cd $PCP_PMDAS_DIR/postgresql
# ./Install
.fi
.ft P
.RE
.sp 1
To uninstall, the following must be done as root:
.sp 1
.RS +4
.ft B
.nf
# cd $PCP_PMDAS_DIR/postgresql
# ./Remove
.fi
.ft P
.RE
.sp 1
\fBpmdapostgresql\fP is launched by \fBpmcd\fP(1) and should never be
executed directly.
The \fBInstall\fP and \fBRemove\fP scripts notify \fBpmcd\fP(1) when
the agent is installed or removed.
.PP
\fBpmdapostgresql\fR will automatically attempt to reconnect to the
PostgreSQL server if its connection is lost - e.g. if the PostgreSQL
service is restarted.
.SH SUPPORTED VERSIONS
This version of \fBpmdapostgresql\fR has been tested and verified with
PostgreSQL server version
.B 10.2
and earlier.
Later versions will probably also work correctly because the PMDA
probes the various performance tables on start-up to determine the
column ordering.
It also tolerates missing or renamed tables and/or columns.
.SH FILES
.TP 5
.I \f(CR$PCP_PMDAS_DIR\fP/postgresql/pmdapostgresql.conf
configuration file for the \fBpmdapostgresql\fR agent
.TP
.I \f(CR$PCP_PMDAS_DIR\fP/postgresql/Install
installation script for the \fBpmdapostgresql\fR agent
.TP
.I \f(CR$PCP_PMDAS_DIR\fP/postgresql/Remove
undo installation script for the \fBpmdapostgresql\fR agent
.TP
.I \f(CR$PCP_LOG_DIR\fP/pmcd/postgresql.log
default log file for messages from the \fBpmdapostgresql\fR agent
.PP
Note that the usual/default value for \fB$PCP_PMDAS_DIR\fP is
.B /var/lib/pcp/pmdas
and the default for \fB$PCP_LOG_DIR\fP is
.B /var/log/pcp
but these settings are platform dependent.
.SH PCP ENVIRONMENT
Environment variables with the prefix \fBPCP_\fR are used to parameterize
the file and directory names used by PCP.
On each installation, the
file \fI/etc/pcp.conf\fR contains the local values for these variables.
The \fB$PCP_CONF\fR variable may be used to specify an alternative
configuration file, as described in \fBpcp.conf\fR(5).
.SH SEE ALSO
.BR PCPIntro (1),
.BR pmcd (1)
and
.BR https://postgresql.org/docs/current/static/monitoring-stats.html .

.\" control lines for scripts/man-spell
.\" +ok+ pmdapostgresql postgresql postgres dbname pg_hba osuser
